#include <iostream>
#include <str.hpp>
#include <vector>

void printVectorItem(std::vector<std::string>, std::string, std::string);

int main() {
    std::vector<std::string> result;
    std::vector<std::string> svec = {
        "1 2 3",
        "1abc2abc3",
        ",1,2,3",
        "1,2,3,",
        ",,1,2,,3,4",
        "1 2  3",
        "1 2  3",
        
    };
    std::vector<std::string> delimvec = {
        "",
        "abc",
        ",",
        ",",
        ",",
        " ",
        " ",
    };
    std::vector<bool> cvec = {
        false,
        false,
        false,
        false,
        true,
        false,
        true,
    };

    for (int i = 0; i < svec.size(); i++) {
        result = split(svec[i], delimvec[i], cvec[i]);
        printVectorItem(result, svec[i], delimvec[i]);
    }

    return 0;
}

void printVectorItem(std::vector<std::string> strvec, std::string str, std::string delim) {
    std::cout << "After split the string [" << str << "] with delimiter [" << delim;
    std::cout << "], the number of substrings is " << strvec.size() << "." << std::endl;
    for (const auto& s : strvec) {
        std::cout << "[" << s << "] ";
    }
    std::cout << std::endl;
}
